package com.yxq.mdt.app.constant;


import android.os.Environment;

import com.blankj.utilcode.util.ScreenUtils;
import com.orhanobut.hawk.Hawk;
import com.yxq.mdt.app.application.App;
import com.yxq.mdt.app.modules.login.bean.UserBean;
import com.yxq.mdt.app.modules.personal.bean.MainPersonTokenBean;
import com.yxq.mdt.app.modules.personal.bean.MyPersonalBean;

/**
 * ================================================
 *
 * @function 常量类
 * Created by yd on 2019-09-27
 * ================================================
 */
public class Constant {


    public static final String FilePath = Environment.getExternalStorageDirectory().getPath() + "/" + App.context.getPackageName() + "/";


    // 微信ID
//    public static final String WECHAT_ID = "wx54c5b1942ec07cb7";
//    public static final String WECHAT_SECRETKEY = "002884266d9cb1091cfcb670b30eee91";
//    public static final String WECHAT_KEY = "qNJP1GJ1ijmjT9ClaF4gNTBNJOd0bjOm";
//    public static final String WECHAT_MCH_ID = "1556533921";

    public static final String WECHAT_ID = "wx24a046c10ad98d48";
    public static final String WECHAT_SECRETKEY = "092712e16cc47ff933ddb5c81d6902d4";
    public static final String WECHAT_KEY = "aba6458d6dab11ea835600e04caa5a99";
    public static final String WECHAT_MCH_ID = "1580514511";
    //微信小程序路径
    public static final String WECHAT_SMALL_APP_PATH = "/pageMore/pages/index/index";
    //小程序原始id
    public static final String WECHAT_SMALL_APP_ID = "gh_51180c371794";
    // 友盟KEY
    public static final String UmengAppKey = "5db948983fc19522be00067c";
    // QQ ID
    public static final String QQ_ID = "101815554";
    public static final String QQ_SECRETKEY = "c34cd230a05323a67eb11d8";

    // 获取验证码倒计时时限
    public static final int CODE_COUNTDOWN_LIMIT = 60;

    public static final String EXTRA_USER_ID = "userId";

    public static final String EXTRA_DIR_ROOT = Environment.getExternalStorageDirectory().getAbsolutePath() + "/";

    public static final int SPAN_COUNT_1_WIDTH = (ScreenUtils.getScreenWidth() - 2 * com.wuhenzhizao.titlebar.utils.ScreenUtils.dp2PxInt(App.getInstance(), 15)); //单张图宽度
    public static final int SPAN_COUNT_3_WIDTH = (int) (1f * (ScreenUtils.getScreenWidth() - 4 * com.wuhenzhizao.titlebar.utils.ScreenUtils.dp2PxInt(App.getInstance(), 15)) / 3 * 24 / 21); //宽：高 210：240
    public static final int SPAN_COUNT_2_WIDTH = (int) (1f * (ScreenUtils.getScreenWidth() - 3 * com.wuhenzhizao.titlebar.utils.ScreenUtils.dp2PxInt(App.getInstance(), 15)) / 2 * 24 / 33); //宽：高 210：240

    /**
     * 返回登录用户信息
     *
     * @return
     */
    public static UserBean getLoginUser() {
        UserBean userBean = Hawk.get(SPKey.SP_KEY_USER_INFO);
        return userBean;
    }

    /**
     * 返回社区用户信息
     *
     * @return
     */
    public static MyPersonalBean getSocialUser() {
        MyPersonalBean userBean = Hawk.get(SPKey.SP_KEY_USER_MY_INFO);
        return userBean;
    }

    /**
     * 返回商城用户Token
     *
     * @return
     */
    public static String getToken() {
        UserBean userBean = Hawk.get(SPKey.SP_KEY_USER_INFO);
        return userBean != null ? userBean.getAccess_token() : "";
    }

    /**
     * 获取社区用户Token
     *
     * @return
     */
    public static String getLbsUserToken() {
        MainPersonTokenBean mainPersonTokenBean = Hawk.get(SPKey.SP_KEY_USER_INFO_TOKEN, null);
        return mainPersonTokenBean != null ? mainPersonTokenBean.getToken() : "";
    }

    /**
     * 获取社区用户ID
     *
     * @return
     */
    public static String getLbsUserID() {
        MainPersonTokenBean mainPersonTokenBean = Hawk.get(SPKey.SP_KEY_USER_INFO_TOKEN, null);
        return mainPersonTokenBean != null ? mainPersonTokenBean.getUserId() : "";
    }

    /**
     * 返回是否第一次安装
     *
     * @return
     */
    public static boolean getFirstInstall() {
        boolean flag = Hawk.get(SPKey.SP_KEY_FIRST_INSTALL, true);
        return flag;
    }

    /**
     * 设置第一次安装状态
     */
    public static void setFirstInstall() {
        Hawk.put(SPKey.SP_KEY_FIRST_INSTALL, false);
    }
}
